<?
print "
<script type=\"text/javascript\">
function setsmile(smile) {
 if(window.opener) {
    data = window.opener.window.document;
    if (data.selection) {
       data.selection.createRange().text=data.selection.createRange().text+smile;
    }else {
        var el=data.getElementById(\"text\");
        el.focus();
        el.value+=smile;
    }
 }
}
</script>
<head><title>Смайлики</title></head>
<table border=1>
  ";
$handle =opendir($cnf['path'].'smile');
$i=0;
    while($file = readdir ($handle)) {
	if ($file == "." || $file == ".."){
              continue;
                }
              if (substr(strtolower($file),-3,3)=='gif'
                  || substr(strtolower($file),-3,3)=='jpg'
                  || substr(strtolower($file),-3,3)=='bmp') {
                     if ($i%3==0) print "<tr>";
                       print "<td><img src='smile/$file' onclick=\"setsmile(':$file:')\"></td>";
                     $i++;
            }
         }
 print "</table>";
closedir($handle);
?>
